#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include "queue.h"

int main()
{
	int i;
	Queue qe;
	Queue temp;
	Item ch;
	time_t now;

	createQueue(&qe);
	
	srand(time(&now));
	for (i = 0;i < MAX_QSIZE;i++){
		ch = 'a' +  rand() % 26;
		enItem(&qe,ch);
	}

	temp = qe;

	i = 0;
	while(!qIsEmpty(&qe)){
		i++;
		deItem(&qe,&ch);
		putchar(ch);
		ch = ((i % (int)sqrt(MAX_QSIZE))?' ':'\n');
		putchar(ch);
	}

	deItem(&temp,&ch);
	deItem(&temp,&ch);
	enItem(&temp,'Q');
	enItem(&temp,'Q');
	
	printf("Another queue: \n");
	i = 0;
	while(!qIsEmpty(&temp)){
		i++;
		deItem(&temp,&ch);
		putchar(ch);
		ch = ((i % (int)sqrt(MAX_QSIZE))?' ':'\n');
		putchar(ch);
	}
	
	return 0;
}

